package com.firmboy.io_collection.collection;

import org.junit.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.TreeSet;

/**
 * set源码分析
 *
 * @author firmboy
 * @create 2018-03-16 上午9:31
 **/
public class Set {

    @Test
    public void test1(){
        TreeSet treeSet = new TreeSet();

        treeSet.add("1");
        treeSet.add("2");

        treeSet.remove("1");

        Object first = treeSet.first();
        System.out.println(first);
    }

    @Test
    public void test2(){
        HashSet<String> set = new HashSet<>();
        set.add("1");
        set.add("2");
        set.add("3");
        set.add(null);

        System.out.println(Arrays.toString(set.toArray()));
    }


}
